package com.medical.core.exception;

public class BaseException extends RuntimeException {

    private String errorCode;
    private String errorMsg;
    private Object[] params;


    public BaseException(String errorCode,String errorMsg){
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(String errorCode,String errorMsg,Object... params){
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.params = params;
    }

    public BaseException(String errorCode,String errorMsg,Throwable e){
        super(e);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    public BaseException(String errorCode,String errorMsg,Throwable e,Object... params){
        super(e);
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
        this.params = params;
    }

    public BaseException(ExceptionEnum exceptionEnums){
        super(exceptionEnums.getErrorMsg());
        this.errorCode = exceptionEnums.getErrorCode();
        this.errorMsg = exceptionEnums.getErrorMsg();
    }
    public BaseException(Throwable e) {
        super(e);
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMsg() {
        return errorMsg;
    }

    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }

    public Object[] getParams() {
        return params;
    }

    public void setParams(Object[] params) {
        this.params = params;
    }
}
